Processing and storing blockchain data under a trusted execution environment

ABSTRACT

Disclosed herein are methods, systems, and apparatus, including computer programs encoded on computer storage media, for processing blockchain data under a trusted execution environment (TEE). One of the methods includes receiving, by a blockchain node, a request to execute one or more software instructions in a TEE executing on the blockchain node; determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request; traversing, by the virtual machine, an internal cache hash table stored in the TEE to determine whether the data are included in the internal cache hash table; and in response to determining that the data is included in the internal cache hash table, executing, by the virtual machine, the one or more software instructions by retrieving the data from the internal cache hash table.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of PCT Application No.PCT/CN2019/081182, filed on Apr. 3, 2019, which is hereby incorporatedby reference in its entirety.

TECHNICAL FIELD

This specification relates to processing and storing blockchain dataunder a trusted execution environment.

BACKGROUND

Distributed ledger systems (DLSs), which can also be referred to asconsensus networks, and/or blockchain networks, enable participatingentities to securely, and immutably store data. DLSs are commonlyreferred to as blockchain networks without referencing any particularuser case. Examples of types of blockchain networks can include publicblockchain networks, private blockchain networks, and consortiumblockchain networks. A consortium blockchain network is provided for aselect group of entities, which control the consensus process, andincludes an access control layer.

Blockchain networks can operate on distributed computing platforms suchas Ethereum. An Ethereum blockchain can be viewed as a transaction-basedstate machine. Ethereum can have a global “shared-state” referred to asa world state. The world state of Ethereum can include objects formed byEthereum accounts. Each account can have a state and a correspondingaddress. The world state comprises a mapping between account addressesand account states. The mapping is stored in a data structure known as aMerkle Patricia tree (MPT).

In some cases, nodes of the blockchain network, and/or nodes thatcommunicate with the blockchain network can operate using trustedexecution environments (TEEs). The TEE can include an enclave trustedcomputing base (TCB) within hardware (one or more processors, memory)that is isolated from the hardware's operating environment (e.g.,operating system (OS), basic input/output system (BIOS)). The TCB caninclude an Ethereum virtual machine (EVM) to process calls fromapplications outside of the enclave. In some cases, one or more valuesof a world state MPT stored outside of the TCB are retrieved by the EVMto process the calls within the TCB. After processing, the processingresult of the call is output from the TCB to update the world state MPT.The data processing from transporting data between trusted and untrustedenvironments can consume additional computing resources and compromisedata processing efficiency. It would be desirable to process the callsat least partially based on data stored in the TCB to reduce datatraffic between trusted and untrusted environments to reduce computingresource consumption and improve data processing efficiency.

SUMMARY

This specification describes technologies for processing and storingblockchain data. These technologies generally involve receiving arequest to execute one or more software instructions in a trustedexecution environment (TEE) executing on the blockchain node;determining data associated with one or more blockchain accounts toexecute the one or more software instructions based on the request;traversing an internal cache hash table stored in the TEE to determinewhether the data are included in the internal cache hash table; and inresponse to determining that the data is included in the internal cachehash table, executing the one or more software instructions byretrieving the data from the internal cache hash table.

This specification also provides one or more non-transitorycomputer-readable storage media coupled to one or more processors andhaving instructions stored thereon which, when executed by the one ormore processors, cause the one or more processors to perform operationsin accordance with embodiments of the methods provided herein.

This specification further provides a system for implementing themethods provided herein. The system includes one or more processors, anda computer-readable storage medium coupled to the one or more processorshaving instructions stored thereon which, when executed by the one ormore processors, cause the one or more processors to perform operationsin accordance with embodiments of the methods provided herein.

It is appreciated that methods in accordance with this specification mayinclude any combination of the aspects and features described herein.That is, methods in accordance with this specification are not limitedto the combinations of aspects and features specifically describedherein, but also include any combination of the aspects and featuresprovided.

The details of one or more embodiments of this specification are setforth in the accompanying drawings and the description below. Otherfeatures and advantages of this specification will be apparent from thedescription and drawings, and from the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram illustrating an example of an environment that canbe used to execute embodiments of this specification.

FIG. 2 is a diagram illustrating an example of an architecture inaccordance with embodiments of this specification.

FIG. 3 is a diagram illustrating an example of a structure of a trustedexecution environment (TEE) and a storage outside of the TEE inaccordance with embodiments of this specification.

FIG. 4 is a flowchart of an example of a process for processing andstoring blockchain data in accordance with embodiments of thisspecification.

FIG. 5 depicts examples of modules of an apparatus in accordance withembodiments of this specification.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

This specification describes technologies for processing and storingblockchain data. These technologies generally involve receiving arequest to execute one or more software instructions in a trustedexecution environment (TEE) executing on the blockchain node;determining data associated with one or more blockchain accounts toexecute the one or more software instructions based on the request;traversing an internal cache hash table stored in the TEE to determinewhether the data are included in the internal cache hash table; and inresponse to determining that the data is included in the internal cachehash table, executing the one or more software instructions byretrieving the data from the internal cache hash table.

To provide further context for embodiments of this specification, and asintroduced above, distributed ledger systems (DLSs), which can also bereferred to as consensus networks (e.g., made up of peer-to-peer nodes),and blockchain networks, enable participating entities to securely, andimmutably conduct transactions, and store data. Although the termblockchain is generally associated with particular networks, and/or usecases, blockchain is used herein to generally refer to a DLS withoutreference to any particular use case.

A blockchain is a data structure that stores transactions in a way thatthe transactions are immutable. Thus, transactions recorded on ablockchain are reliable and trustworthy. A blockchain includes one ormore blocks. Each block in the chain is linked to a previous blockimmediately before it in the chain by including a cryptographic hash ofthe previous block. Each block also includes a timestamp, its owncryptographic hash, and one or more transactions. The transactions,which have already been verified by the nodes of the blockchain network,are hashed and encoded into a Merkle tree. A Merkle tree is a datastructure in which data at the leaf nodes of the tree is hashed, and allhashes in each branch of the tree are concatenated at the root of thebranch. This process continues up the tree to the root of the entiretree, which stores a hash that is representative of all data in thetree. A hash purporting to be of a transaction stored in the tree can bequickly verified by determining whether it is consistent with thestructure of the tree.

Whereas a blockchain is a decentralized or at least partiallydecentralized data structure for storing transactions, a blockchainnetwork is a network of computing nodes that manage, update, andmaintain one or more blockchains by broadcasting, verifying andvalidating transactions, etc. As introduced above, a blockchain networkcan be provided as a public blockchain network, a private blockchainnetwork, or a consortium blockchain network. Embodiments of thisspecification are described in further detail herein with reference to aconsortium blockchain network. It is contemplated, however, thatembodiments of this specification can be realized in any appropriatetype of blockchain network.

In general, a consortium blockchain network is private among theparticipating entities. In a consortium blockchain network, theconsensus process is controlled by an authorized set of nodes, which canbe referred to as consensus nodes, one or more consensus nodes beingoperated by a respective entity (e.g., a financial institution,insurance company). For example, a consortium of ten (10) entities(e.g., financial institutions, insurance companies) can operate aconsortium blockchain network, each of which operates at least one nodein the consortium blockchain network.

In some examples, within a consortium blockchain network, a globalblockchain is provided as a blockchain that is replicated across allnodes. That is, all consensus nodes are in perfect state consensus withrespect to the global blockchain. To achieve consensus (e.g., agreementto the addition of a block to a blockchain), a consensus protocol isimplemented within the consortium blockchain network. For example, theconsortium blockchain network can implement a practical Byzantine faulttolerance (PBFT) consensus, described in further detail below.

FIG. 1 is a diagram illustrating an example of an environment 100 thatcan be used to execute embodiments of this specification. In someexamples, the environment 100 enables entities to participate in aconsortium blockchain network 102. The environment 100 includescomputing devices 106, 108, and a network 110. In some examples, thenetwork 110 includes a local area network (LAN), wide area network(WAN), the Internet, or a combination thereof, and connects web sites,user devices (e.g., computing devices), and back-end systems. In someexamples, the network 110 can be accessed over a wired and/or a wirelesscommunications link. In some examples, the network 110 enablescommunication with, and within the consortium blockchain network 102. Ingeneral the network 110 represents one or more communication networks.In some cases, the computing devices 106, 108 can be nodes of a cloudcomputing system (not shown), or each computing device 106, 108 can be aseparate cloud computing system including a number of computersinterconnected by a network and functioning as a distributed processingsystem.

In the depicted example, the computing systems 106, 108 can each includeany appropriate computing system that enables participation as a node inthe consortium blockchain network 102. Examples of computing devicesinclude, without limitation, a server, a desktop computer, a laptopcomputer, a tablet computing device, and a smartphone. In some examples,the computing systems 106, 108 hosts one or more computer-implementedservices for interacting with the consortium blockchain network 102. Forexample, the computing system 106 can host computer-implemented servicesof a first entity (e.g., user A), such as a transaction managementsystem that the first entity uses to manage its transactions with one ormore other entities (e.g., other users). The computing system 108 canhost computer-implemented services of a second entity (e.g., user B),such as a transaction management system that the second entity uses tomanage its transactions with one or more other entities (e.g., otherusers). In the example of FIG. 1, the consortium blockchain network 102is represented as a peer-to-peer network of nodes, and the computingsystems 106, 108 provide nodes of the first entity, and second entityrespectively, which participate in the consortium blockchain network102.

FIG. 2 depicts an example of an architecture 200 in accordance withembodiments of this specification. The architecture 200 includes anentity layer 202, a hosted services layer 204, and a blockchain networklayer 206. In the depicted example, the entity layer 202 includes threeparticipants, Participant A, Participant B, and Participant C, eachparticipant having a respective transaction management system 208.

In the depicted example, the hosted services layer 204 includesinterfaces 210 for each transaction management system 208. In someexamples, a respective transaction management system 208 communicateswith a respective interface 210 over a network (e.g., the network 110 ofFIG. 1) using a protocol (e.g., hypertext transfer protocol secure(HTTPS)). In some examples, each interface 210 provides communicationconnection between a respective transaction management system 208, andthe blockchain network layer 206. More particularly, the interface 210communicate with a blockchain network 212 of the blockchain networklayer 206. In some examples, communication between an interface 210, andthe blockchain network layer 206 is conducted using remote procedurecalls (RPCs). In some examples, the interfaces 210 “host” blockchainnetwork nodes for the respective transaction management systems 208. Forexample, the interfaces 210 provide the application programminginterface (API) for access to blockchain network 212.

As described herein, the blockchain network 212 is provided as apeer-to-peer network including a plurality of nodes 214 that immutablyrecord information in a blockchain 216. Although a single blockchain 216is schematically depicted, multiple copies of the blockchain 216 areprovided, and are maintained across the blockchain network 212. Forexample, each node 214 stores a copy of the blockchain. In someembodiments, the blockchain 216 stores information associated withtransactions that are performed between two or more entitiesparticipating in the consortium blockchain network.

A blockchain (e.g., the blockchain 216 of FIG. 2) is made up of a chainof blocks, each block storing data. Examples of data include transactiondata representative of a transaction between two or more participants.While transactions are used herein by way of non-limiting example, it iscontemplated that any appropriate data can be stored in a blockchain(e.g., documents, images, videos, audio). Examples of a transaction caninclude, without limitation, exchanges of something of value (e.g.,assets, products, services, currency). The transaction data is immutablystored within the blockchain. That is, the transaction data cannot bechanged.

Before storing in a block, the transaction data is hashed. Hashing is aprocess of transforming the transaction data (provided as string data)into a fixed-length hash value (also provided as string data). It is notpossible to un-hash the hash value to obtain the transaction data.Hashing ensures that even a slight change in the transaction dataresults in a completely different hash value. Further, and as notedabove, the hash value is of fixed length. That is, no matter the size ofthe transaction data the length of the hash value is fixed. Hashingincludes processing the transaction data through a hash function togenerate the hash value. An example of a hash function includes, withoutlimitation, the secure hash algorithm (SHA)-256, which outputs 256-bithash values.

Transaction data of multiple transactions are hashed and stored in ablock. For example, hash values of two transactions are provided, andare themselves hashed to provide another hash. This process is repeateduntil, for all transactions to be stored in a block, a single hash valueis provided. This hash value is referred to as a Merkle root hash, andis stored in a header of the block. A change in any of the transactionswill result in change in its hash value, and ultimately, a change in theMerkle root hash.

Blocks are added to the blockchain through a consensus protocol.Multiple nodes within the blockchain network participate in theconsensus protocol, and perform work to have a block added to theblockchain. Such nodes are referred to as consensus nodes. PBFT,introduced above, is used as a non-limiting example of a consensusprotocol. The consensus nodes execute the consensus protocol to addtransactions to the blockchain, and update the overall state of theblockchain network.

In further detail, the consensus node generates a block header, hashesall of the transactions in the block, and combines the hash value inpairs to generate further hash values until a single hash value isprovided for all transactions in the block (the Merkle root hash). Thishash is added to the block header. The consensus node also determinesthe hash value of the most recent block in the blockchain (i.e., thelast block added to the blockchain). The consensus node also adds anonce value, and a timestamp to the block header.

In general, PBFT provides a practical Byzantine state machinereplication that tolerates Byzantine faults (e.g., malfunctioning nodes,malicious nodes). This is achieved in PBFT by assuming that faults willoccur (e.g., assuming the existence of independent node failures, and/ormanipulated messages sent by consensus nodes). In PBFT, the consensusnodes are provided in a sequence that includes a primary consensus node,and backup consensus nodes. The primary consensus node is periodicallychanged, Transactions are added to the blockchain by all consensus nodeswithin the blockchain network reaching an agreement as to the worldstate of the blockchain network. In this process, messages aretransmitted between consensus nodes, and each consensus nodes provesthat a message is received from a specified peer node, and verifies thatthe message was not modified during transmission.

In PBFT, the consensus protocol is provided in multiple phases with allconsensus nodes beginning in the same state. To begin, a client sends arequest to the primary consensus node to invoke a service operation(e.g., execute a transaction within the blockchain network). In responseto receiving the request, the primary consensus node multicasts therequest to the backup consensus nodes. The backup consensus nodesexecute the request, and each sends a reply to the client. The clientwaits until a threshold number of replies are received. In someexamples, the client waits for f+1 replies to be received, where f isthe maximum number of faulty consensus nodes that can be toleratedwithin the blockchain network. The final result is that a sufficientnumber of consensus nodes come to an agreement on the order of therecord that is to be added to the blockchain, and the record is eitheraccepted, or rejected.

In some blockchain networks, cryptography is implemented to maintainprivacy of transactions. For example, if two nodes want to keep atransaction private, such that other nodes in the blockchain networkcannot discern details of the transaction, the nodes can encrypt thetransaction data. An example of cryptography includes, withoutlimitation, symmetric encryption, and asymmetric encryption. Symmetricencryption refers to an encryption process that uses a single key forboth encryption (generating ciphertext from plaintext), and decryption(generating plaintext from ciphertext). In symmetric encryption, thesame key is available to multiple nodes, so each node can en-/de-crypttransaction data.

Asymmetric encryption uses keys pairs that each include a private key,and a public key, the private key being known only to a respective node,and the public key being known to any or all other nodes in theblockchain network. A node can use the public key of another node toencrypt data, and the encrypted data can be decrypted using other node'sprivate key. For example, and referring again to FIG. 2, Participant Acan use Participant B's public key to encrypt data, and send theencrypted data to Participant B. Participant B can use its private keyto decrypt the encrypted data (ciphertext) and extract the original data(plaintext). Messages encrypted with a node's public key can only bedecrypted using the node's private key.

Asymmetric encryption is used to provide digital signatures, whichenables participants in a transaction to confirm other participants inthe transaction, as well as the validity of the transaction. Forexample, a node can digitally sign a message, and another node canconfirm that the message was sent by the node based on the digitalsignature of Participant A. Digital signatures can also be used toensure that messages are not tampered with in transit. For example, andagain referencing FIG. 2, Participant A is to send a message toParticipant B. Participant A generates a hash of the message, and then,using its private key, encrypts the hash to provide a digital signatureas the encrypted hash. Participant A appends the digital signature tothe message, and sends the message with digital signature to ParticipantB. Participant B decrypts the digital signature using the public key ofParticipant A, and extracts the hash. Participant B hashes the messageand compares the hashes. If the hashes are same, Participant B canconfirm that the message was indeed from Participant A, and was nottampered with.

In some embodiments, nodes of the blockchain network, and/or nodes thatcommunicate with the blockchain network can operate using TEEs. At ahigh-level, a TEE is a trusted environment within hardware (one or moreprocessors, memory) that is isolated from the hardware's operatingenvironment (e.g., operating system (OS), basic input/output system(BIOS)). In further detail, a TEE is a separate, secure area of aprocessor that ensures the confidentiality, and integrity of codeexecuting, and data loaded within the main processor. Within aprocessor, the TEE runs in parallel with the OS. At least portions ofso-called trusted applications (TAs) execute within the TEE, and haveaccess to the processor and memory. Through the TEE, the TAs areprotected from other applications running in the main OS. Further, theTEE cryptographically isolates TAs from one another inside the TEE.

An example of a TEE includes Software Guard Extensions (SGX) provided byIntel Corporation of Santa Clara, Calif., United States. Although SGX isdiscussed herein by way of example, it is contemplated that embodimentsof this specification can be realized using any appropriate TEE.

SGX provides a hardware-based TEE. In SGX, the trusted hardware is thedie of the central processing until (CPU), and a portion of physicalmemory is isolated to protect select code and data. The isolatedportions of memory are referred to as enclaves. More particularly, anenclave is provided as an enclave page cache (EPC) in memory and ismapped to an application address space. The memory (e.g., DRAM) includesa preserved random memory (PRM) for SGX. The PRM is a continuous memoryspace in the lowest BIOS level and cannot be accessed by any software.Each EPC is a memory set (e.g., 4 KB) that is allocated by an OS to loadapplication data and code in the PRM. EPC metadata (EPCM) is the entryaddress for respective EPCs and ensures that each EPC can only be sharedby one enclave. That is, a single enclave can use multiple EPCs, whilean EPC is dedicated to a single enclave.

During execution of a TA, the processor operates in a so-called enclavemode when accessing data stored in an enclave. Operation in the enclavemode enforces an extra hardware check to each memory access. In SGX, aTA is compiled to a trusted portion, and an untrusted portion. Thetrusted portion is inaccessible by, for example, OS, BIOS, privilegedsystem code, virtual machine manager (VMM), system management mode(SMM), and the like. In operation, the TA runs and creates an enclavewithin the PRM of the memory. A trusted function executed by the trustedportion within the enclave is called by the untrusted portion, and codeexecuting within the enclave sees the data as plaintext data(unencrypted), and external access to the data is denied.

In some embodiments, a virtual machine operating inside of an enclaveTCB can provide a trusted runtime environment for applications tosecurely execute smart contracts. The virtual machine can receive callsfrom the applications outside of the enclave. The calls can invokeenclave interface functions to initiate execution of the smartcontracts. During smart contract execution, the virtual machine canretrieve data associated with blockchain accounts based on inputparameters of the calls or content of the smart contracts. Data fromblockchain accounts can include blockchain account states such asaccount balances or storage contents of the accounts (e.g., accountvariables).

In some cases, frequently accessed account data or account data likelyto be accessed can be stored in an internal cache hash table inside ofthe enclave in plaintext. When retrieving account data to execute thesmart contracts, the virtual machine can first traverse the internalcache hash table to locate the data. If the data cannot be located aftertraversing the internal cache hash table, a call can be made to outsideof the enclave to traverse an external cache hash table stored in cachestorage through direct memory access. The external cache hash table canstore account information of frequently accessed accounts. If theaccount data cannot be located after traversing the external cache hashtable, a call can be made to retrieve the account data from a MerklePatricia tree (MPT) corresponding to the global state of the blockchainstored in a database.

FIG. 3 is a diagram illustrating an example of a structure 300 of a TEEand a storage outside of the TEE in accordance with embodiments of thisspecification. At a high-level, the structure 300 includes a TEE in theform of an enclave TCB (or simply TCB) 302 that stores a virtual machine304 and an internal cache hash table 308, an external cache hash table310, and a world state 314 in the form of an MPT stored in a database320.

As discussed above, a TA, such as an SGX enabled application, caninclude a trusted component (or enclave component) and an untrustedcomponent (application component). The application component is locatedoutside of the enclave and can access the TCB 302 through enclaveinterface functions. In some embodiments, the enclave can expose anapplication programming interface (API) for the application component tocall in. The application component can use the API to make “ecalls” 306to invoke a virtual machine 304 in the enclave to execute smartcontracts. The virtual machine can be an emulation of a computer system.For example, the virtual machine can be an Ethereum virtual machine(EVM) under the context of an Ethereum blockchain. It is to beunderstood that other blockchain networks can use other variations ofvirtual machines. After receiving an ecall 306, the virtual machine 304can identify one or more blockchain accounts related to executing thesmart contracts. The identification can be based on one or more inputparameters of the ecall 306 or the content of the smart contracts. Forexample, an ecall 306 can be made by an application component to executea smart contract of adding a new transaction between two blockchainaccounts to the blockchain. The virtual machine 305 can identify keys(i.e., account addresses) to retrieve account balances from thecorresponding account states.

After identifying the account data to be used to execute the smartcontract, the virtual machine 304 can traverse the internal cache hashtable 308 to locate the account data. In some embodiments, frequentlyaccessed account data or data likely to be accessed can be stored in aninternal cache hash table 308 in the TCB 302. The internal cache hashtable 308 can be a two-dimensional (2D) table that stores KVPscorresponding to the data. The data stored in the internal cache hashtable 308 can be those that are most likely to be retrieved by thevirtual machine 304 to execute the smart contracts. The likelihood canbe estimated based on historical or predicted account access frequency.In some examples, the frequently accessed account data can be the datathat were retrieved by the virtual machine 304 over a predeterminednumber of times or during a predetermined time period. In some examples,the data likely to be accessed can be the data that were previouslyretrieved to execute smart contracts related to the smart contract thatis currently executed.

The corresponding KVPs of the data in the internal cache hash table 308can be retrieved from the world state 314 MPT of the blockchain. Assuch, the likelihood that the virtual machine 304 can retrieve at leasta portion of account data from the internal cache hash table to executethe smart contract increases. Correspondingly, the likelihood that thevirtual machine 304 needs to retrieve account data from outside of theTCB 302 decreases.

The world state 314 can sometimes be referred to as a global state. Eachblockchain network can have one global state. The global state caninclude a mapping between account addresses and the account states ofthe blockchain. Each blockchain account is an object of the globalstate. As discussed above, the global state mapping can be stored in adata structure known as an MPT. The account addresses and account statescan be stored in the MPT as KVPs. The global state MPT is a hash of theglobal state at a given point in time. The global state can include aroot node used as a secure and unique identifier for the MPT. The globalstate MPT's root node can be cryptographically dependent on datarepresenting the account states.

In the structure 300 depicted in FIG. 3, two accounts with respectiveaccount state0 316 and account state1 318 are shown under the worldstate 314. It is to be understood that the blockchain network caninclude more than two accounts. The blockchain accounts can beexternally owned accounts and contract accounts. Externally ownedaccounts can be controlled by private keys and are not associated withany code. Contract accounts can be controlled by their contract code andhave code associated with them.

In some embodiments, the account state can include four components knownas nonce, balance, codeHash, and storageRoot. If the account is anexternally owned account, the nonce can represent the number oftransactions sent from the account address. The balance can representthe digital assets owned by the account. The codeHash is the hash of anempty string. The storageRoot is empty. If the account is a contractaccount, the nonce can represent the number of contracts created by theaccount. The balance can represent the digital assets owned by theaccount. The codeHash can be the hash of a virtual machine codeassociated with the account. The storageRoot can store a hash of theroot node of an MPT referred to as a storage tree. The storage tree canstore contract data by encoding the hash of the storage contents of theaccount. Since the storage tree also has a data structure of MPT, it caninclude one or more branch nodes and leaf nodes that store contract dataor variables.

If the virtual machine 304 cannot locate the account data aftertraversing the internal cache hash table 308, it can make a call 312 tolocate the data from outside of the TCB 302. A call made from within theenclave to an outside application component can be referred to as anocall 312. In some embodiments, the ocall 312 can be made to retrievethe data from an external cache hash table 310 stored in a cache memoryoutside of the enclave. The external cache hash table 310 can be a 2Dtable that stores data of frequently accessed accounts or accounts thatare likely to be accessed. Data of an account can include the accountstate (i.e., nonce, balance, codeHash, etc.) and the storage contentstored as the storage tree. The external cache hash table 310 can storeKVPs corresponding to account states and storage contents of thefrequently accessed accounts. The corresponding KVPs stored in theexternal cache hash table 310 can be retrieved from the world state 314.In some examples, the external cache hash table 310 can be accessed fromthe enclave through direct memory access.

If the virtual machine 304 cannot locate the account data aftertraversing the external cache hash table 310, the virtual machine cantraverse the world state 314 stored in a database 320 to locate theaccount data. In some examples, the database 320 can be databases forKVPs, such as RocksDB or LevelDB.

After using the account data to execute the smart contract, theexecution results can be used to update the world state 314. If theaccount data used are stored in the internal cache hash table 308, theKVPs corresponding to the updated account data can be first cachesynchronized with the corresponding KVPs in the external cache hashtable 310. Afterwards, the external cache hash table 310 can cachesynchronize the corresponding KVPs with the database 320 to update themin the world state 314 MPT. If the account data used are stored in theexternal cache hash table 308, the virtual machine 304 can make an ocall312 to update the corresponding KVPs in the external cache hash table310. The external cache hash table 310 can then cache synchronize withthe database 320 to update the corresponding KVPs in the world state314.

If the account data used are stored in the database 320, the virtualmachine 304 can make an ocall 313 to update the corresponding KVPs inthe world state 314. As described above, output data is encrypted beforeexiting the enclave. As such, the external cache hash table 310 and theworld state 308 stored outside of the TCB 302 cannot be viewed withoutobtaining the corresponding decryption key.

By storing frequently access account data in the internal cache hashtable 308 inside of the TCB 302, the likelihood that the virtual machine304 needs to retrieve account data from outside of the TCB 302 toexecute smart contracts can be reduced. As data entering and exiting theenclave TCB 302 needs to be decrypted and encrypted, which increasecomputational burden, less calls for data outside of the TCB 302 canreduce computational resource consumption and improve computationalefficiency.

FIG. 4 is a flowchart of an example of a process 400 for processing andstoring blockchain data in accordance with embodiments of thisspecification. For convenience, the process 400 will be described asbeing performed by a system of one or more computers, located in one ormore locations, and programmed appropriately in accordance with thisspecification. For example, computing systems 106, 108 of FIG. 1,appropriately programmed, can perform the process 400.

At 402, a blockchain node participating in a blockchain network receivesa request to execute one or more software instrucitons in a TEEexecuting on the blockchain node.

At 404, a virtual machine in the TEE determines data associated with oneor more blockchain accounts associated with the one or more softwareinstructions. In some examples, the blockchain accounts are associatedwith a blockchain maintained by the blockchian network. In someexamples, the plurality of blockchain accounts include one or more ofexternally owned accounts or contract accounts, and wherein each of thecontracts accounts includes a storage root. In some examples, thestorage root includes a hash of a root node of an MPT. The MPT canencode hash of storage contents of the corresponding contract account.

At 406, the virtual machine traverses an internal cache hash tablestored in the TEE to determine that the data are included in an internalcache hash table. In some examples, the data associated with the one ormore blockchain accounts are one or more KVPs, and the internal cachehash table stores a plurality of KVPs associated with frequentlyaccessed storage contents of a plurality of accounts of a blockchain.

At 408, in response to determining that the data is included in theinternal cache hash table, the virtual machine executes the one or moresoftware instructions by retrieving the data from the internal cachehash table. In some examples, in response to executing the one or moresoftware instructions, the virtual machine updates the one or more KVPs.In some example, the blockchain node synchronizes the internal cachehash table with an external cache hash table that includes the one ormore KVPs. In some examples, the external cache hash table is stored ina cache separate from the TEE. In some examples, the external cache hashtable stores a plurality of KVPs associated with one or morefrequently-accessed accounts of the blockchain.

In some embodiments, the request is a first request, the one or moresoftware instructions are first software instructions, the one or moreKVPs are first KVPs. The blockchain node further receives a secondrequest to execute second software instructions in the TEE. The virtualmachine determines second KVPs associated with the second softwareinstructions, and the virtual machine determines that the second KVPsare not included in the internal cache hash table.

In some embodiments, in response to determining that the second KVPs arenot included in the internal cache hash table, the virtual machinefurther determines that the second KVPs are included in the externalcache hash table. In some examples, the virtual machine accesses theexternal cache hash table through direct memory access. The virtualmachine executes the second software instructions based on the secondKVPs. In response to executing the one or more software instructions,the blockchain node updates the second KVPs included in the externalcache hash table, and synchronizes the external cache hash table with aglobal state of the blockchain stored in a database separate from theTEE.

In some embodiments, in response to determining that the second KVPs arenot included in the internal cache hash table, the virtual machinedetermines that the second KVPs are not included in the external cachehash table. In response to determining that the second KVPs are notincluded in the external cache hash table, the virtual machine executesthe second software instructions by retrieving the second KVPs from theglobal state of the blockchain, and the blockchain node updates thesecond KVPs in response to executing the one or more softwareinstructions. In some embodiments, the global state is stored in thedatabase as an MPT.

FIG. 5 is a diagram of on example of modules of an apparatus 500 inaccordance with embodiments of this specification. The apparatus 500 canbe an example of an embodiment of a trusted hardware including portionsof the CPU and physical memory. The apparatus 500 can correspond to theembodiments described above, and the apparatus 500 includes thefollowing:

A request receiving module 502 to receive a request to execute one ormore software instructions in a TEE executing on the blockchain node; adata determination module 504 to determine data associated with one ormore blockchain accounts associated with the one or more softwareinstructions, wherein the blockchain accounts are associated with ablockchain maintained by the blockchain network, and determine that thedata is included in an internal cache hash table stored in the TEE; aprocessing module 506 to execute the one or more software instructionsbased on the one or more KVPs in response to determining that the datais included in the internal cache hash table; a data updating sub-module508 to update the data in response to executing the one or more softwareinstructions; and a synchronization sub-module 510 to synchronize theinternal cache hash table with an external cache hash table thatincludes the one or more KVPs, wherein the external cache hash table isstored in a cache separate from the TEE.

Optionally, internal cache hash table stores KVPs associated withfrequently-accessed blockchain accounts of the blockchain.

Optionally, the request is a first request, the one or more softwareinstructions are first software instructions, the one or more KVPs arefirst KVPs, and the request receiving module 502 further receives asecond request to execute second software instructions in the TEE; theKVP determination module 504 determines a second KVPs associated withthe second software instructions, and that the second KVPs are notincluded in the internal cache hash table.

Optionally, in response to determining that the second KVPs are notincluded in the internal cache hash table, the KVP determination module504 determines that the second KVPs are included in the external cachehash table, wherein the virtual machine accesses the external cache hashtable through direct memory access; the processing module 506 executesthe second software instructions based on the second KVPs; in responseto executing the one or more software instructions, the KVP updatingmodule 508 updates the second KVPs included in the external cache hashtable; and the synchronization module 510 synchronizes the externalcache hash table with a global state of the blockchain stored in adatabase separate from the TEE.

Optionally, the external cache hash table stores a plurality of KVPsassociated with one or more frequently-accessed accounts of theblockchain.

Optionally, in response to determining that the second KVPs are notincluded in the internal cache hash table, the KVP determination module504 determines that the second KVPs are not included in the externalcache hash table; in response to determining that the second KVPs arenot included in the external cache hash table, the processing unit 506executes the second software instructions by retrieving the second KVPsfrom the global state of the blockchain; and the KVP updating unit 508updates the second KVPs in response to executing the one or moresoftware instructions.

Optionally, the global state is stored in the database as an MPT.

Optionally, the global state includes a mapping between addresses andstates of a plurality of blockchain accounts of the blockchain, and theplurality of blockchain accounts include one or more of externally-ownedaccounts or contract accounts, and wherein each of the contract accountsincludes a storage root.

The techniques described in this specification produce several technicaleffects. For example, embodiments of the subject matter permit ablockchain virtual machine running in a trusted environment to receivecalls from applications outside of a TCB to execute smart contracts. Bystoring the frequently accessed blockchain account in an internal cachehash table inside the TCB, the likelihood that the virtual machine canretrieve blockchain data from within the TCB increases. Consequently,the data traffic between trusted and untrusted components decreases.Because data traveling between the trusted and untrusted components needto be encrypted or decrypted, less data traffic through enclave canresult in less computational resource consumption and higher datasecurity. Moreover, by including the frequently accessed account datawithin the TCB, the data retrieval and update are more likely performedbased on plaintext in a trusted environment to improve computationalefficiency and data security.

The described methodology permits enhancement of various blockchaintransactions and overall transaction/data security. Blockchain usersthat initiate the call to execute smart contracts can be confident thatthe computations are performed in a trusted environment and thecomputational results cannot be altered.

The described methodology can ensure the efficient usage of computerresources (for example, processing cycles, network bandwidth, and memoryusage), because frequently accessed blockchain data are stored inplaintext, and retrieved and updated inside of the TEE. At least theseactions can reduce waste of available computer resources with respect toblockchain data encryption and decryption. Instead of virtual machinesneeding to decrypt data retrieved from outside of TEE for smart contractprocessing, they can directly operate on plaintext inside of the enclavefor frequently accessed data.

The system, apparatus, module, or unit illustrated in the previousembodiments can be implemented by using a computer chip or an entity, orcan be implemented by using a product having a certain function. Atypical embodiment device is a computer, and the computer can be apersonal computer, a laptop computer, a cellular phone, a camera phone,a smartphone, a personal digital assistant, a media player, a navigationdevice, an email receiving and sending device, a game console, a tabletcomputer, a wearable device, or any combination of these devices.

For an embodiment process of functions and roles of each module in theapparatus, references can be made to an embodiment process ofcorresponding steps in the previous method. Details are omitted here forsimplicity.

Because an apparatus embodiment basically corresponds to a methodembodiment, for related parts, references can be made to relateddescriptions in the method embodiment. The previously describedapparatus embodiment is merely an example. The modules described asseparate parts may or may not be physically separate, and partsdisplayed as modules may or may not be physical modules, may be locatedin one position, or may be distributed on a number of network modules.Some or all of the modules can be selected based on actual demands toachieve the objectives of the solutions of the specification. A personof ordinary skill in the art can understand and implement theembodiments of the present application without creative efforts.

Embodiments of the subject matter and the actions and operationsdescribed in this specification can be implemented in digital electroniccircuitry, in tangibly-embodied computer software or firmware, incomputer hardware, including the structures disclosed in thisspecification and their structural equivalents, or in combinations ofone or more of them. Embodiments of the subject matter described in thisspecification can be implemented as one or more computer programs, e.g.,one or more modules of computer program instructions, encoded on acomputer program carrier, for execution by, or to control the operationof, data processing apparatus. For example, a computer program carriercan include one or more computer-readable storage media that haveinstructions encoded or stored thereon. The carrier may be a tangiblenon-transitory computer-readable medium, such as a magnetic, magnetooptical, or optical disk, a solid state drive, a random access memory(RAM), a read-only memory (ROM), or other types of media. Alternatively,or in addition, the carrier may be an artificially generated propagatedsignal, e.g., a machine-generated electrical, optical, orelectromagnetic signal that is generated to encode information fortransmission to suitable receiver apparatus for execution by a dataprocessing apparatus. The computer storage medium can be or be part of amachine-readable storage device, a machine-readable storage substrate, arandom or serial access memory device, or a combination of one or moreof them. A computer storage medium is not a propagated signal.

A computer program, which may also be referred to or described as aprogram, software, a software application, an app, a module, a softwaremodule, an engine, a script, or code, can be written in any form ofprogramming language, including compiled or interpreted languages, ordeclarative or procedural languages; and it can be deployed in any form,including as a stand-alone program or as a module, component, engine,subroutine, or other unit suitable for executing in a computingenvironment, which environment may include one or more computersinterconnected by a data communication network in one or more locations.

A computer program may, but need not, correspond to a file in a filesystem. A computer program can be stored in a portion of a file thatholds other programs or data, e.g., one or more scripts stored in amarkup language document, in a single file dedicated to the program inquestion, or in multiple coordinated files, e.g., files that store oneor more modules, sub programs, or portions of code.

Processors for execution of a computer program include, by way ofexample, both general- and special-purpose microprocessors, and any oneor more processors of any kind of digital computer. Generally, aprocessor will receive the instructions of the computer program forexecution as well as data from a non-transitory computer-readable mediumcoupled to the processor.

The term “data processing apparatus” encompasses all kinds ofapparatuses, devices, and machines for processing data, including by wayof example a programmable processor, a computer, or multiple processorsor computers. Data processing apparatus can include special-purposelogic circuitry, e.g., an FPGA (field programmable gate array), an ASIC(application specific integrated circuit), or a GPU (graphics processingunit). The apparatus can also include, in addition to hardware, codethat creates an execution environment for computer programs, e.g., codethat constitutes processor firmware, a protocol stack, a databasemanagement system, an operating system, or a combination of one or moreof them.

The processes and logic flows described in this specification can beperformed by one or more computers or processors executing one or morecomputer programs to perform operations by operating on input data andgenerating output. The processes and logic flows can also be performedby special-purpose logic circuitry, e.g., an FPGA, an ASIC, or a GPU, orby a combination of special-purpose logic circuitry and one or moreprogrammed computers.

Computers suitable for the execution of a computer program can be basedon general or special-purpose microprocessors or both, or any other kindof central processing unit. Generally, a central processing unit willreceive instructions and data from a read only memory or a random accessmemory or both. Elements of a computer can include a central processingunit for executing instructions and one or more memory devices forstoring instructions and data. The central processing unit and thememory can be supplemented by, or incorporated in, special-purpose logiccircuitry.

Generally, a computer will also include, or be operatively coupled toreceive data from or transfer data to one or more storage devices. Thestorage devices can be, for example, magnetic, magneto optical, oroptical disks, solid state drives, or any other type of non-transitory,computer-readable media. However, a computer need not have such devices.Thus, a computer may be coupled to one or more storage devices, such as,one or more memories, that are local and/or remote. For example, acomputer can include one or more local memories that are integralcomponents of the computer, or the computer can be coupled to one ormore remote memories that are in a cloud network. Moreover, a computercan be embedded in another device, e.g., a mobile telephone, a personaldigital assistant (PDA), a mobile audio or video player, a game console,a Global Positioning System (GPS) receiver, or a portable storagedevice, e.g., a universal serial bus (USB) flash drive, to name just afew.

Components can be “coupled to” each other by being commutatively such aselectrically or optically connected to one another, either directly orvia one or more intermediate components. Components can also be “coupledto” each other if one of the components is integrated into the other.For example, a storage component that is integrated into a processor(e.g., an L2 cache component) is “coupled to” the processor.

To provide for interaction with a user, embodiments of the subjectmatter described in this specification can be implemented on, orconfigured to communicate with, a computer having a display device,e.g., a LCD (liquid crystal display) monitor, for displaying informationto the user, and an input device by which the user can provide input tothe computer, e.g., a keyboard and a pointing device, e.g., a mouse, atrackball or touchpad. Other kinds of devices can be used to provide forinteraction with a user as well; for example, feedback provided to theuser can be any form of sensory feedback, e.g., visual feedback,auditory feedback, or tactile feedback; and input from the user can bereceived in any form, including acoustic, speech, or tactile input. Inaddition, a computer can interact with a user by sending documents toand receiving documents from a device that is used by the user; forexample, by sending web pages to a web browser on a user's device inresponse to requests received from the web browser, or by interactingwith an app running on a user device, e.g., a smartphone or electronictablet. Also, a computer can interact with a user by sending textmessages or other forms of message to a personal device, e.g., asmartphone that is running a messaging application, and receivingresponsive messages from the user in return.

This specification uses the term “configured to” in connection withsystems, apparatus, and computer program components. For a system of oneor more computers to be configured to perform particular operations oractions means that the system has installed on it software, firmware,hardware, or a combination of them that in operation cause the system toperform the operations or actions. For one or more computer programs tobe configured to perform particular operations or actions means that theone or more programs include instructions that, when executed by dataprocessing apparatus, cause the apparatus to perform the operations oractions. For special-purpose logic circuitry to be configured to performparticular operations or actions means that the circuitry has electroniclogic that performs the operations or actions.

While this specification contains many specific embodiment details,these should not be construed as limitations on the scope of what isbeing claimed, which is defined by the claims themselves, but rather asdescriptions of features that may be specific to particular embodiments.Certain features that are described in this specification in the contextof separate embodiments can also be realized in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiments can also be realized in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially be claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claim may be directed to a subcombination orvariation of a subcombination.

Similarly, while operations are depicted in the drawings and recited inthe claims in a particular order, this should not be understood asrequiring that such operations be performed in the particular ordershown or in sequential order, or that all illustrated operations beperformed, to achieve desirable results. In certain circumstances,multitasking and parallel processing may be advantageous. Moreover, theseparation of various system modules and components in the embodimentsdescribed above should not be understood as requiring such separation inall embodiments, and it should be understood that the described programcomponents and systems can generally be integrated together in a singlesoftware product or packaged into multiple software products.

Particular embodiments of the subject matter have been described. Otherembodiments are within the scope of the following claims. For example,the actions recited in the claims can be performed in a different orderand still achieve desirable results. As one example, the processesdepicted in the accompanying figures do not necessarily require theparticular order shown, or sequential order, to achieve desirableresults. In some cases, multitasking and parallel processing may beadvantageous.

What is claimed is:
 1. A computer-implemented method for processing blockchain data under a trusted execution environment (TEE), the method comprising: receiving, by a blockchain node, a request to execute one or more software instructions in a TEE executing on the blockchain node; determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request, wherein the data associated with the one or more blockchain accounts are one or more key-value pairs (KVPs), and an internal cache hash table stores a plurality of KVPs associated with frequently accessed storage contents of a plurality of accounts of a blockchain; traversing, by the virtual machine, the internal cache hash table stored in the TEE to determine whether the data are included in the internal cache hash table; traversing, by the blockchain node, an external cache hash table through direct memory access to determine a first portion of KVPs that are included in the external cache hash table and a second portion of KVPs that are not included in the internal cache hash table; in response to determining that the data is included in the internal cache hash table, executing, by the virtual machine, the one or more software instructions by retrieving the data from the internal cache hash table and by retrieving the second portion of KVPs from the external cache hash table, if the second portion of KVPs are included in the external cache hash table; updating, by the virtual machine, the internal cache hash table in response to executing the one or more software instructions; updating, by the blockchain node, the external cache hash table in response to executing the one or more software instructions; and synchronizing, by the blockchain node, the external cache hash table with a global state of a blockchain stored in a database separate from the TEE and the internal cache hash table with the external cache hash table that comprises data associated with the one or more blockchain accounts, wherein the external cache hash table is stored in a cache memory separate from the TEE.
 2. The computer-implemented method of claim 1, wherein the external cache hash table stores a plurality of KVPs associated with states and storage content of frequently accessed accounts of the blockchain.
 3. The computer-implemented method of claim 1, further comprising: executing, by the virtual machine, the one or more software instructions by retrieving the second portion of KVPs from the global state, if the second portion of—KVPs are not included in the internal cache hash table or the external cache hash table; and updating, by the blockchain node, the global state in response to executing the one or more software instructions.
 4. The computer-implemented method of claim 1, wherein the global state is stored in the database outside of an enclave as a Merkle Patricia tree (MPT).
 5. The computer-implemented method of claim 1, wherein the global state includes a mapping between addresses and states of a plurality of blockchain accounts of the blockchain, and the plurality of blockchain accounts include one or more of externally owned accounts or contract accounts, and wherein each of the contracts accounts includes a storage root.
 6. The computer-implemented method of claim 5, wherein the storage root comprises a hash of a root node of an MPT, and wherein the MPT encodes hash of storage contents of the corresponding contract account.
 7. A non-transitory, computer-readable storage medium storing one or more instructions executable by a computer system to perform operations for processing blockchain data under a trusted execution environment (TEE), the operations comprising: receiving, by a blockchain node, a request to execute one or more software instructions in a TEE executing on the blockchain node; determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request, wherein the data associated with the one or more blockchain accounts are one or more key-value pairs (KVPs), and an internal cache hash table stores a plurality of KVPs associated with frequently accessed storage contents of a plurality of accounts of a blockchain; traversing, by the virtual machine, the internal cache hash table stored in the TEE to determine whether the data are included in the internal cache hash table; traversing, by the blockchain node, an external cache hash table through direct memory access to determine a first portion of KVPs that are included in the external cache hash table and a second portion of KVPs that are not included in the internal cache hash table; in response to determining that the data is included in the internal cache hash table, executing, by the virtual machine, the one or more software instructions by retrieving the data from the internal cache hash table and by retrieving the second portion of KVPs from the external cache hash table, if the second portion of KVPs are included in the external cache hash table; updating, by the virtual machine, the internal cache hash table in response to executing the one or more software instructions; updating, by the blockchain node, the external cache hash table in response to executing the one or more software instructions; and synchronizing, by the blockchain node, the external cache hash table with a global state of a blockchain stored in a database separate from the TEE and the internal cache hash table with the external cache hash table that comprises data associated with the one or more blockchain accounts, wherein the external cache hash table is stored in a cache memory separate from the TEE.
 8. The non-transitory, computer-readable storage medium of claim 7, wherein the external cache hash table stores a plurality of KVPs associated with states and storage content of frequently accessed accounts of the blockchain.
 9. The non-transitory, computer-readable storage medium of claim 7, the operations further comprising: executing, by the virtual machine, the one or more software instructions by retrieving the second portion of KVPs from the global state, if the second portion of KVPs are not included in the internal cache hash table or the external cache hash table; and updating, by the blockchain node, the global state in response to executing the one or more software instructions.
 10. The non-transitory, computer-readable storage medium of claim 7, wherein the global state is stored in the database outside of an enclave as a Merkle Patricia tree (MPT).
 11. The non-transitory, computer-readable storage medium of claim 7, wherein the global state includes a mapping between addresses and states of a plurality of blockchain accounts of the blockchain, and the plurality of blockchain accounts include one or more of externally owned accounts or contract accounts, and wherein each of the contracts accounts includes a storage root.
 12. The non-transitory, computer-readable storage medium of claim 11, wherein the storage root comprises a hash of a root node of an MPT, and wherein the MPT encodes hash of storage contents of the corresponding contract account.
 13. A computer-implemented system for processing blockchain data under a trusted execution environment (TEE), the computer-implemented system comprising: one or more computers; and one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform one or more operations comprising: receiving, by a blockchain node, a request to execute one or more software instructions in a TEE executing on the blockchain node, determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request, wherein the data associated with the one or more blockchain accounts are one or more key-value pairs (KVPs), and an internal cache hash table stores a plurality of KVPs associated with frequently accessed storage contents of a plurality of accounts of a blockchain; traversing, by the virtual machine, the internal cache hash table stored in the TEE to determine whether the data are included in the internal cache hash table; traversing, by the blockchain node, an external cache hash table through direct memory access to determine a first portion of KVPs that are included in the external cache hash table and a second portion of KVPs that are not included in the internal cache hash table; in response to determining that the data is included in the internal cache hash table, executing, by the virtual machine, the one or more software instructions by retrieving the data from the internal cache hash table and by retrieving the second portion of KVPs from the external cache hash table, if the second portion of KVPs are included in the external cache hash table; updating, by the virtual machine, the internal cache hash table in response to executing the one or more software instructions; updating, by the blockchain node, the external cache hash table in response to executing the one or more software instructions; and synchronizing, by the blockchain node, the external cache hash table with a global state of a blockchain stored in a database separate from the TEE and the internal cache hash table with the external cache hash table that comprises data associated with the one or more blockchain accounts, wherein the external cache hash table is stored in a cache memory separate from the TEE.
 14. The computer-implemented system of claim 13, wherein the external cache hash table stores a plurality of KVPs associated with states and storage content of frequently accessed accounts of the blockchain.
 15. The computer-implemented system of claim 13, the operations further comprising: executing, by the virtual machine, the one or more software instructions by retrieving the second portion of KVPs from the global state, if the second portion of KVPs are not included in the internal cache hash table or the external cache hash table; and updating, by the blockchain node, the global state in response to executing the one or more software instructions.
 16. The computer-implemented system of claim 13, wherein the global state is stored in the database outside of an enclave as a Merkle Patricia tree (MPT).
 17. The computer-implemented system of claim 13, wherein the global state includes a mapping between addresses and states of a plurality of blockchain accounts of the blockchain, and the plurality of blockchain accounts include one or more of externally owned accounts or contract accounts, and wherein each of the contracts accounts includes a storage root.
 18. The computer-implemented system of claim 17, wherein the storage root comprises a hash of a root node of an MPT, and wherein the MPT encodes hash of storage contents of the corresponding contract account. 